Graph theory applications in congenital heart disease

Graph theory can be used to address problems with complex network structures. Congenital heart diseases (CHDs) involve complex abnormal connections between chambers, vessels, and organs. We proposed a new method to represent CHDs based on graph theory, wherein vertices were defined as the spaces through which blood flows and edges were defined by the blood flow between the spaces and direction of the blood flow. The CHDs of tetralogy of Fallot (TOF) and transposition of the great arteries (TGA) were selected as examples for constructing directed graphs and binary adjacency matrices. Patients with totally repaired TOF, surgically corrected d-TGA, and Fontan circulation undergoing four-dimensional (4D) flow magnetic resonance imaging (MRI) were included as examples for constructing the weighted adjacency matrices. The directed graphs and binary adjacency matrices of the normal heart, extreme TOF undergoing a right modified Blalock–Taussig shunt, and d-TGA with a ventricular septal defect were constructed. The weighted adjacency matrix of totally repaired TOF was constructed using the peak velocities obtained from 4D flow MRI. The developed method is promising for representing CHDs and may be helpful in developing artificial intelligence and conducting future research on CHD.


Results
Directed graphs of the heart. The directed graphs of the normal heart, extreme TOF undergoing a right mBT shunt, and d-TGA with a VSD are shown in Fig. 1. First, we drew the directed graph of the normal heart. Second, in the case of extreme TOF undergoing a right mBT shunt, the connection between the RV and PT was removed because of pulmonary atresia. An edge from the RV to LV and an edge from the LV to RV were added to the graph of the normal heart to represent VSD. Furthermore, the right mBT shunt was added to the graph as an additional vertex v 25 = mBT shunt, which allowed blood flow from the RSCA to RPA first, and then to supply the bilateral lungs. The direction of the edge between PT and RPA was reversed due to the presence of pulmonary atresia and the blood flow supplied by the right mBT shunt. Finally, we drew the graph of d-TGA by eliminating the normal connections between the ventricles and great arteries (RV to PT, LV to AAo) and adding discordant connections (RV to AAo, LV to PT) to the graph of the normal heart. A VSD is mandatory to form the paths from systemic venous return (SVC, IVC) to the lungs (RL, LL) and the paths from the lungs to the arterial supply (AAo). This allows patients with d-TGA to return deoxygenated blood from the body, exchange gases in the lungs, and pump oxygenated blood to the systemic circulation that keeps survival.
Binary adjacency matrices of the hearts. The binary adjacency matrices of the normal heart, extreme TOF undergoing a right mBT shunt, and d-TGA with a VSD are shown in Fig. 2. Let B = [b ij ] and C = [c ij ] be the binary adjacency matrices of extreme TOF undergoing a right mBT shunt and d-TGA with a VSD, respectively. For the matrix of extreme TOF undergoing a right mBT shunt, an additional vertex caused the dimension of the matrix to increase from 24 × 24 to 25 × 25. The elements b 23,25 = 1 and b 25,6 = 1 represent the blood flow from RSCA to RPA via the right mBT shunt. The elements b 4,15 = 1 and b 15,4 = 1 represent the bidirectional VSD. The element b 4,5 = 0 indicates pulmonary atresia. The elements b 5,6 = 0 and b 6,5 = 1 indicate the reversed blood flow from the RPA to the PT. For the matrix of d-TGA with a VSD, the elements c 4,5 = 0 and c 15,16 = 0 represent disconnection between the RV and PT, as well as between the LV and AAo, respectively. The elements c 4,16 = 1 and c 15,5 = 1 represent abnormal connections between the RV and AAo, as well as the LV and PT. In summary, these elements indicate ventriculoarterial discordance. The matrix of d-TGA can also be considered as the result of interchanging the 5th column (PT) and the 16th column (AAo) of the matrix of the normal heart.
Weighted adjacency matrices of the hearts. The data of three patients who underwent 4D flow MRI and had three different conditions-totally repaired TOF, surgically corrected d-TGA, and Fontan circulationwere included. The process of constructing the weighted adjacency matrix for totally repaired TOF based on the results of 4D flow MRI is shown in Fig. 3. Regarding flow measurements, we usually only focus on a specific portion of the heart in clinical practice. Therefore, a submatrix of the binary adjacency matrix of the whole heart was selected to create the weighted adjacency matrix. In this case, we were interested in the peak velocities of blood flows between the RV, PT, RPA, and LPA. Initially, the peak velocities were measured at the boundaries of the spaces on 4D flow MRI (pulmonary valve and the origins of the RPA and LPA, the short white lines in Fig. 3) and were used as weights in the weighted adjacency matrix. Then, the submatrix including the vertices of interest was derived from the binary adjacency matrix of totally repaired TOF. After the weights and corresponding elements of the submatrix were combined, the weighted adjacency matrix of peak velocity was obtained. In the same way, the weighted adjacency matrices of surgically corrected d-TGA and Fontan circulation were constructed (Fig. 4).

Discussion
This study provided a representation of CHDs through graphs, binary and weighted adjacency matrices by using graph theory. We generated graph representations of the normal heart, TOF, and TGA. Based on the differences between the graph of the normal heart and that of CHDs, CHDs can be classified into five categories: (1) increased vertices; (2) decreased vertices; (3) increased edges; (4) decreased edges; and (5) abnormal connections. Examples for the five categories of binary adjacency matrices are shown in Table 1. The procedures to treat CHDs is also related to the addition and subtraction of these vertices and edges, as well as the correction of www.nature.com/scientificreports/ Figure 1. Directed graphs of (a) the normal heart, (b) extreme TOF undergoing a right mBT shunt, and (c) d-TGA with a VSD. In the case of extreme TOF undergoing a right mBT shunt, the edge from the RV to PT is absent due to pulmonary atresia. The bidirectional edges between the RV and LV represent the VSD. An additional vertex, v 25 , represents the mBT shunt, which allows blood flow from the RSCA to the RPA to supply the lungs. The direction of the edge between PT and RPA was reversed due to the presence of pulmonary atresia and the blood flow supplied by the right mBT shunt. In the graph of d-TGA, the connections between the ventricles and great arteries are discordant (RV to AAo, LV to PT www.nature.com/scientificreports/ abnormal connections. Manifestations of the common surgical procedures in the binary adjacency matrices are shown in Table 2. For the CHDs and procedures associated with changes in vertices, we increased the dimensions of the adjacency matrices for the category of increased vertices while keeping the dimension unchanged for the category of decreased vertices. The reason for this is that a vertex is a chamber or a vascular structure with a real space and can connect to other vertices. Therefore, an additional vertex requires more dimension in the adjacency matrix to express the possible connections with all the other vertices. By contrast, the absence of a vertex can be expressed by eliminating all the edges connected to the vertex. Thus, isolating the vertex from the other vertices is equivalent to removal of the vertex from the graph in our cases. Our methods for defining the vertices and edges of the graph are similar to those used in studies on graph theory applications in the human heart 5-8 . However, our models are more detailed and practical than those used in previous studies. For example, our model comprised four vertices to represent four pulmonary veins. This design is crucial for describing anomalous pulmonary venous return but has been rarely used in other studies. In addition, most previous models have only included the cardiovascular structures from the vena cavae to the aorta. By contrast, we included the structures from the vena cavae to the branches of the aorta because the branches include the innominate artery, carotid arteries, and subclavian arteries, which also play a role in CHDs and are often associated with additional blood supply to the lungs, such as mBT shunt and systemic-to-pulmonary collateral arteries. Moreover, we added the vertex of SCTO to complete the circuit of the entire circulatory system. Abnormalities in the connections between systemic arterial supply, SCTO, and systemic venous return are usually associated with cardiovascular diseases in adults such as atherosclerotic occlusive diseases, arterial dissections, deep vein thrombosis, and SVC syndrome. The aim of this study was not to establish the standard graph representation of the human heart but to propose a feasible model. Various graph representations can be adopted depending on the purpose. For instance, if information on more detailed structures, such as coronary arteries, segments of the aorta, and pulmonary arteries, is required, more vertices can be added into the graph. Moreover, the graph representations can include dynamic changes obtained from imaging modalities such echocardiography and cardiac MRI. Finite-state machine may be used to describe the dynamic changes of blood flow, chamber and vessels in the cardiac cycle 19,20 .
In addition to the human heart, graph theory has been applied to other systems and organs in the human body. One of the most important applications of graph theory is the connectome in neuroscience. Since the coining of the term connectome in 2005, the number of related studies has markedly increased, with more than 1000 publications per year over the past few years 21 . Graph theoretical analysis of complex brain networks reveals that the human connectome can be a diagnostic marker of several neurodegenerative and psychiatric diseases 22 . Graph theory is also used to build models of brain vessels, the hepatic portal system, the glomerular capillary network, and the lymphatic system [23][24][25][26][27][28][29] .
The increasing survivorship of patients with CHD increases the prevalence of CHD, and as a result, physicians without having training in CHD may need to manage these patients 30 . Graph representation simplifies the www.nature.com/scientificreports/ complex cardiovascular structures and makes them easier to understand for the physicians and patients. Furthermore, according to previous graph theory-based studies, we propose some applications of our CHD model.

Artificial intelligence in CHD.
If there is an artificial intelligence model capable of segmenting the cardiovascular structures in CHDs on the imaging, we can obtain the boundaries of these structures and detect the blood flow between them. By doing so, we can establish the connections between these structures and construct the graphs of the hearts. By comparing these graphs with the established graphs of CHDs in this study, we can obtain the diagnoses for the congenital heart diseases of the hearts. For example, if the morphologic RA, RV, LA, LV, AAo and PT can be automatically identified and segmented on MRI, atrioventricular and ventriculoarterial connections can be established using 4D flow MRI. If blood flow is detected from the RV to the AAo and from the LV to the PT, the diagnosis of TGA can be made (Fig. 1c). Furthermore, through 4D flow MRI and appropriate segmentation of cardiovascular structures, hemodynamic abnormalities such as regurgitation and increased velocity due to vascular stenosis can be automatically detected. Although the automatic segmentation and classification of CHD in medical imaging are challenging due to the complex cardiovascular structures involved, with advances in machine learning techniques, many feasible models have been proposed [31][32][33] . For automatic segmentation, graph matching, which is a graph theory-based technique, has been adopted to improve the performance of deep learning models. Graph matching in a previous study involved the construction of a graph library to describe all possible connections between great vessels 32 . Various graph representations and categories of CHDs demonstrated in the present study can be used to establish a comprehensive graph library and can facilitate the development of deep learning in CHD.
Connectome of the heart. Similar to the application of the connectome in the neurological disorders, graph representations of the heart can be applied to heart diseases 34 . In this study, we demonstrated that the changes in the numbers of vertices, edges, and connections were associated with the structural or hemodynamic www.nature.com/scientificreports/ abnormalities of the heart. In addition, imaging modalities such as echocardiography and cardiac MRI, similar to electroencephalography, diffusion tensor imaging, and functional MRI in neuroscience, can be used to construct weighted adjacency matrices, which can store the hemodynamic parameters of the heart in the matrices and enable further analysis to find unknown relationships between the matrices and heart diseases 35-37 . Finding unknown types, pathophysiology, and treatments of CHDs. The number of all possible directed graphs with 24 vertices is 2 (24×23) -1.47 × 10 166 , which is considerably more than the types of CHDs currently known. This observation implies that some cardiovascular structures of the possible directed graphs have not yet been discovered or reported, while some cardiovascular structures cannot exist due to certain reasons. We can find unknown types of CHDs through the following steps: (1) given 24 vertices, as defined above, generate all possible directed graphs; (2) exclude the known CHDs based on our knowledge and literal searches on databases such as PubMed and Google Scholar; (3) the remaining non-excluded directed graphs are the possible unknown cardiovascular structures of CHDs. For each possible unknown cardiovascular structure, we can use our knowledge of physiology and embryology to determine the existence of this cardiac structure. A well-known rule for patients with CHDs to survive is "there exists a lung such that a path from the systemic venous return to the lung and a path from the lung to the systemic arterial supply", which we can see in the patients with extreme  (Fig. 1c). The patient cannot survive due to a lack of oxygenated blood in the systemic circulation. In addition, other unknown factors may also affect survival of CHD. Therefore, scrutinizing all possible cardiovascular structures by using our model, we may find unknown CHDs and unknown rules associated with the existence of CHDs, that is, (cardiovascular structures of all possible directed graphs with the given vertices) − (known cardiovascular structures) − (abnormal cardiovascular structures incompatible with life because of the known rules) = (abnormal cardiovascular structures compatible with life but not reported yet) + (abnormal cardiovascular structures incompatible with life because of unknown rules). For example, congenital anomalies such as congenital total absence of SVC and congenital aortocaval fistula to the SVC are extremely rare anomalies and have never been recorded in some institutes 38,39 . However, the existence of the anomalies can be predicted using our model. Furthermore, the procedures for treatment of CHDs such as mBT shunt, Norwood procedure, bidirectional Glenn shunt and Fontan procedure can also be derived from our model. The unknown treatments of CHDs may be discovered in all possible directed graphs with the given vertices. The proposed graph representations of CHDs have some limitations. They cannot describe abnormal spatial relationships between cardiovascular structures such as the situs inversus, L-loop, overriding aorta, right aortic arch, aberrant subclavian artery, retroaortic left innominate vein, and anomalous course of coronary arteries. Some spatial relationships may be represented by adding new vertices based on embryology 40,41 . Moreover, a   www.nature.com/scientificreports/ binary adjacency matrix cannot describe two edges with the same origin vertex, destination vertex and direction. Further research is needed to find the more general graph models to describe CHDs.
In conclusion, graph theory can be used to represent CHDs, which may be helpful for developing artificial intelligence and conducting future research on CHD.

Data availability
The datasets used and/or analyzed during the current study available from the corresponding author on reasonable request.